

stateChange.$inject = [

    '$rootScope',
    '$location'
];

function stateChange($rootScope,$location) {

    $rootScope.$on('$locationChangeStart', function(event, toState, fromState) {


        console.log('state change');
        // if(sessionStorage.m==undefined){
        //     console.log('no login');
        //     // $state.go('login');
        //     $location.path("/info");
        //     return;
        // }
        // console.log(sessionStorage.m);
        //ERROR IS IN THIS BLOCK
        // if($rootScope.authenticated && $rootScope.onboard == 0) {
        //
        //     //event.preventDefault();
        //
        //     $state.transitionTo("onboard", null, {notify:false});
        //     $state.go('onboard');
        // }
    });

}

module.exports = stateChange;
